package com.flca.frw.util
{
	import mx.rpc.soap.WebService;
	import mx.rpc.soap.SOAPHeader;
	import mx.rpc.http.HTTPService;
	
	public class MasterDataUtil 
	{
		public static function readMasterItems(aMasterXml:XML, aCategory:String, aCodes:Array, aLabels:Array):void
		{
			var masterItems:XMLList;
			
			masterItems = aMasterXml.child(aCategory).mapping;
			for each (var masterItem:XML in masterItems)
			{
				aCodes.push(masterItem.@code.toString());
				aLabels.push(masterItem.@label.toString());
			}
			
			return;
		}
		
		public static function getLabel(aCode:String, aCodes:Array, aLabels:Array):String
		{
			var result:String;
			
			for (var i:int = 0; i < aCodes.length; i++)
			{
				if (aCodes[i] == aCode)
				{
					result = aLabels[i];
					break;
				}
			}
			
			return result;
		}
	}
}